Building an E-Commerce Application with MEAN by Adrian Mejia

Building an E-Commerce Application with MEAN by Adrian Mejia

Author:Adrian Mejia [Mejia, Adrian]
Language: eng
Format: azw3
Publisher: Packt Publishing
Published: 2015-11-23T05:00:00+00:00


Seeding products

Now that we have everything in place, let's create some mock products to work with. Feel free to use your creativity here:

/* server/config/seed.js */ var Product = require('../api/product/product.model'); Product.find({}).removeAsync() .then(function() { Product.createAsync({ title: 'MEAN eCommerce Book', imageUrl: '/assets/uploads/meanbook.jpg', price: 25, stock: 250, description: 'Build a powerful e-commerce...' }, { title: 'tshirt', imageUrl: '/assets/uploads/meantshirt.jpg', price: 15, stock: 100, description: 'tshirt with the MEAN logo' }, { title: 'coffee mug', imageUrl: '/assets/uploads/meanmug.jpg', price: 8, stock: 50, description: 'Convert coffee into MEAN code' }) .then(function() { console.log('finished populating products'); }); });



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.